<?php
/**
 * Smarty: 模板引擎
 * @author andery <andery@foxmail.com>
 * @link http://www.minophp.com/
 * @version $Id: TemplateSmarty.php 2010-05-23 02:10:55Z andery $
 */
class CTemplateSmarty{
    // 扩展类名
    public $vd_name = 'Smarty';
    private $_smarty;
    
    public function __construct($tpl_config)
    {
        include_once(NIMO_VENDORS . '/' . Nimo::$_vendors[$this->vd_name]);
        $this->_smarty = new Smarty();
        $this->_smarty->caching = $tpl_config['caching'];
        $this->_smarty->template_dir = $tpl_config['template_dir'];
        $this->_smarty->compile_dir = $tpl_config['compile_dir'];
        $this->_smarty->cache_dir = $tpl_config['cache_dir'];
        $tpl->left_delimiter = $tpl_config['left_delimiter'];
        $tpl->right_deliniter = $tpl_config['right_deliniter'];
    }
    
    public function assign($tpl_data, $value = '')
    {
        $this->_smarty->assign($tpl_data, $value);
    }
    
    public function display($tplfile)
    {
        $this->_smarty->display($tplfile);
    }
}